#make src/test/Makefile.in	-*- Makefile -*-
@MCOMMON@

srcdir =	@srcdir@
VPATH =		@srcdir@
.PATH:		@srcdir@

basedir = ../..
thisdir = src/test

first_rule: 
dummy:

SRCS = gettty.c	strings-memmove.c
OBJS = gettty.o	strings-memmove.o
HDRS =

#
# Distribution variables
#
DEBUG= -DDEBUG_TTY

DIST = $(HDRS) $(SRCS) Makefile.in

# inference rules
.c.o:
	$(CC) -c $(CPPFLAGS) $(XINC) -I. -I$(basedir) -I$(srcdir) $(DEFS) $(CFLAGS) $<
#-------------------------------------------------------------------------
all:

tests:
	@(cd $(srcdir)/..; ${MAKE} .protos)
	@${MAKE} tests-bin run-tests

tests-bin: gettty gettty-debug strings-memmove

run-tests:
	@echo ""
	@echo "RUNNING TESTS ----"
	@echo "Testing open of (pty/tty) pseudo-tty pairs"
	@./gettty concise || ./gettty-debug
	@echo "Testing possible replacement for memmove() with --enable-strings"
	@./strings-memmove

gettty: gettty.o ptytty.o
	$(CC) $(LDFLAGS) -o $@ gettty.o ptytty.o $(LIBS)

gettty-debug: gettty.o ptytty-debug.o
	$(CC) $(LDFLAGS) -o $@ gettty.o ptytty-debug.o $(LIBS)

ptytty.o: $(srcdir)/../ptytty.c
	$(CC) -o ptytty.o $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/../ptytty.c

ptytty-debug.o: $(srcdir)/../ptytty.c
	$(CC) -o ptytty-debug.o $(CPPFLAGS) $(CFLAGS) $(DEBUG) -c $(srcdir)/../ptytty.c

strings-memmove: strings-memmove.o
	$(CC) $(LDFLAGS) -o $@ strings-memmove.o $(LIBS)

$(srcdir)/../strings.intpro: $(srcdir)/../strings.c
	(cd $(srcdir)/..; ${MAKE} strings.intpro)

tags: $(SRCS)
	ctags $(SRCS)

allbin:

alldoc:

clean:
	$(RMF) gettty strings-memmove core a.out *.o *.bak *~

realclean: clean
	$(RMF) tags

cleandir: realclean

distclean:
	(cd $(srcdir); $(RMF) strings-memmove *~ *.o core a.out)
	if test $(srcdir) = .; then $(MAKE) realclean; fi
	(cd $(srcdir); $(RMF) Makefile)

install:

uninstall:

distdirs:
	mkdir $(basedir)/../$(VERNAME)/$(thisdir)

distcopy:
	$(CP) -p $(DIST) $(basedir)/../$(VERNAME)/$(thisdir)

# -----------------------------------------------------------------------
# DO NOT DELETE: ugly dependency list follows

strings-memmove.o:	strings-memmove.c $(srcdir)/../strings.c $(srcdir)/../strings.intpro
